import { createRouter } from 'uni-mini-router'
import type { App } from 'vue'
import {createAfterEachGuard, createBeforeEachGuard} from "@/router/guard";

const router = createRouter({
	// 此处的 ROUTES 就是配置 vite.config.ts 步骤中注入的
	routes: [...ROUTES] // 路由表信息
})

export function setupRouter(app : App<Element>) {
	app.use(router)
	createBeforeEachGuard(router)
	createAfterEachGuard(router)
}

export { router }